home *** CD-ROM | disk | FTP | other *** search
- /*
- * the class CPlaceCompDialog
- * Copyright (C) 1997 Kazutaka Hirata <khirata@jove.acs.unt.edu>
- */
-
- #include "../stdafx.h"
- #include <afxdlgs.h>
-
- #include "plcmpdlg.h"
-
- BEGIN_MESSAGE_MAP(CPlaceCompDialog, CDialog)
- ON_EN_CHANGE(IDC_COMP_NAME, OnChangeName)
- ON_COMMAND(IDC_COMP_BROWSE, OnBrowse)
- END_MESSAGE_MAP()
-
- BOOL CPlaceCompDialog::OnInitDialog(void)
- {
- m_component_name.Empty();
- m_designator.Empty();
- ctlOKButton().EnableWindow(false);
- CDialog::OnInitDialog();
- return TRUE;
- }
-
- void CPlaceCompDialog::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- DDX_Text(pDX, IDC_COMP_NAME , m_component_name);
- DDX_Text(pDX, IDC_COMP_DESIGNATOR, m_designator );
- }
-
- void CPlaceCompDialog::OnChangeName(void)
- {
- CString name;
- ctlName().GetWindowText(name);
- bool bEnableOK = (name.GetLength() != 0) ? true : false;
- ctlOKButton().EnableWindow(bEnableOK);
- }
-
- void CPlaceCompDialog::OnBrowse(void)
- {
- CFileDialog dlg(TRUE, "cmp", m_component_name,
- OFN_PATHMUSTEXIST | OFN_HIDEREADONLY,
- "kban Component Files (*.cmp)|*.cmp|All Files (*.*)|*.*||",
- this
- );
- if(dlg.DoModal() == IDOK) {
- m_component_name = dlg.GetPathName();
- CEdit& ctlFileName = *(CEdit*)GetDlgItem(IDC_COMP_NAME);
- ctlFileName.SetWindowText(m_component_name);
- }
- }
-